var d_tid = GetQueryString("d_tid");
var d_wcid = GetQueryString("d_wcid");
var d_tpid = GetQueryString("d_tpid");
var w_did = GetQueryString("w_did");
//显示基本信息
var infomation = [];
for (let i = 0; i < 2; i++) {
    infomation[i] = document.getElementById("infomation" + i).children[0];
}
var infomationData = [
    [["产品名称", "部件名称", "项目名称", "检测部位", "热处理状况", "检测时机", "检测标准", "技术等级"], []]
];
$.ajax({
    url: '/op/operation',
    type: 'post',
    data: {
        "requestType": "initOpData",
        "w_did": w_did,
        "wc_id": d_wcid,
        "task_id": d_tid
    },
    async: false,
    success: function (data, status) {
        if (status == 'success') {
            postData = data;
        }
    },
    error: function (data, status) {
        if (status == 'error') {
            alert("你的网络有问题！");
        }
    }
});
console.log(postData);
infomationData[0][1] = [
    postData["base"][0].task_product,
    postData["base"][0].wc_pipeName,
    postData["base"][0].task_pname,
    postData["base"][0].task_position,
    postData["base"][0].task_heat,
    postData["base"][0].task_opportunity,
    postData["base"][0].task_standard,
    postData["base"][0].task_level
];
tech_id = postData["base"][0].tech_id;
document.getElementById("wc_weldM").value = postData["base"][0].op_weldM;
document.getElementById("wc_texture").value = postData["base"][0].op_texture;
document.getElementById("tech_focus").value = postData["base"][0].op_focus;
document.getElementById("tech_filmV").value = postData["base"][0].op_filmV;
document.getElementById("tech_devTime").value = postData["base"][0].op_devTime;
document.getElementById("tech_devT").value = postData["base"][0].op_devT;
document.getElementById("wc_scale").value = postData["base"][0].op_scale;

document.getElementById("op_equ").value = postData["base"][0].op_equ;
document.getElementById("op_equid").value = postData["base"][0].op_equid;
document.getElementById("op_filmBrand").value = postData["base"][0].op_filmBrand;
document.getElementById("op_liquor").value = postData["base"][0].op_liquor;
document.getElementById("op_sensitizer").value = postData["base"][0].op_sensitizer;
document.getElementById("op_front").value = postData["base"][0].op_front;
document.getElementById("op_rear").value = postData["base"][0].op_rear;
document.getElementById("op_remark").value = postData["base"][0].op_remark;
document.getElementById("op_photo").value = postData["base"][0].op_photo;
document.getElementById("op_wash").value = postData["base"][0].op_wash;
var date1=new Date(postData["base"][0].op_pdate);
postData["base"][0].op_pdate= date1.getFullYear() + "-" + (date1.getMonth() + 1) + "-" + date1.getDate();
date1.getDate();
var date2=new Date(postData["base"][0].op_wdate);
postData["base"][0].op_wdate = date2.getFullYear() + "-" + (date2.getMonth() + 1) + "-" + date2.getDate();
date2.getDate();
document.getElementById("op_pdate").value = postData["base"][0].op_pdate == null ? "" : postData["base"][0].op_pdate;
document.getElementById("op_wdate").value = postData["base"][0].op_wdate == null ? "" : postData["base"][0].op_wdate;
for (let j = 0; j < 1; j++) {
    for (let i = 0; i < infomationData[j][0].length; i++) {
        let tr = document.createElement("tr");
        if (i % 3 === 0) {
            infomation[j].appendChild(tr);
        }
        let td = document.createElement("td");
        td.setAttribute("class", "td-shadows");
        td.setAttribute("align", "center");
        td.innerHTML = infomationData[j][0][i];
        infomation[j].children[infomation[j].childElementCount - 1].appendChild(td);
        td = document.createElement("td");
        td.setAttribute("align", "center");
        td.innerHTML = infomationData[j][1][i];
        infomation[j].children[infomation[j].childElementCount - 1].appendChild(td);
    }
}

var workpieceTitle = ["部件/管线编号", "工件/焊缝编号", "实际规格", "管电压", "管电流/源活度", "曝光时间", "透照次数",
    "透照方式", "像质计型号", "摆放位置"];
var workpieceTable = document.getElementById("infomation1").children[1];
var workpieceInfo = [];
for (let i = 0; i < postData["workpiece"].length; i++) {
    workpieceInfo.push([
        postData["workpiece"][i].w_pipeNum,
        postData["workpiece"][i].w_weldNum,
        postData["workpiece"][i].w_rspec,
        postData["workpiece"][i].w_V,
        postData["workpiece"][i].w_A,
        postData["workpiece"][i].w_time,
        postData["workpiece"][i].w_phoNum,
        postData["workpiece"][i].w_tranType,
        postData["workpiece"][i].w_IQIV,
        postData["workpiece"][i].w_pos,
    ]);
}
for (let i = 0; i < workpieceTitle.length; i++) {
    let th = document.createElement("th");
    th.innerHTML = workpieceTitle[i];
    infomation[1].children[0].appendChild(th);
}
for (let i = 0; i < workpieceInfo.length; i++) {
    let tr = document.createElement("tr");
    for (let j = 0; j < workpieceTitle.length; j++) {
        let th = document.createElement("th");
        th.innerHTML = workpieceInfo[i][j];
        tr.appendChild(th);
    }
    workpieceTable.appendChild(tr);
}